package com.stone.inventory.sharding.config.properties;

import com.stone.starter.redis.config.properties.RedisCacheProperties;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * redis 分片属性配置
 *
 * @author Mr_wenpan@163.com 2021-07-26
 */
@ConfigurationProperties(prefix = "stone.inv.redis")
@Data
public class InvRedisProperty {

    /**
     * 默认的redis实例名称
     */
    private String defaultInstance;

    /**
     * 缓存实例名称
     */
    private String cacheInstance;

    /**
     * 表和redis映射，key为逻辑表名，value为对应的Redis实例名称
     */
    private Map<String, String> shardingMapping;

    /**
     * redis实例
     */
    private Map<String, RedisCacheProperties> instances;

    public InvRedisProperty() {
        shardingMapping = new LinkedHashMap<>();
        instances = new LinkedHashMap<>();
    }
}
